Package | ch.fhir.ig.ch-alis |
Type | StructureMap |
Id | Id |
FHIR Version | R4 |
Source | http://fhir.ch/ig/ch-alis/https://build.fhir.org/ig/ahdis/ch-alis/StructureMap-Alis43ToBundle.html |
Url | http://fhir.ch/ig/ch-alis/StructureMap/Alis43ToBundle |
Version | 0.3.0 |
Status | draft |
Date | 2024-10-29T15:42:46+00:00 |
Name | Alis43ToBundle |
Experimental | False |
Realm | ch |
Authority | hl7 |
Description | Convert ALIS43 XML to a Bundle according to the CH ALIS implmementation guide, 2020-12-03 by Oliver Egger, copyright ahdis ag, Apache License, FHIR: http://hl7.org/fhir/r4/. ISSUE7: what are the URL's oid's we have to define. |
Copyright | not-open-source |
No resources found
No resources found
Note: links and images are rebased to the (stated) source
/// url = "http://fhir.ch/ig/ch-alis/StructureMap/Alis43ToBundle" /// name = "Alis43ToBundle" /// title = "null" /// status = "draft" // Convert ALIS43 XML to a Bundle according to the CH ALIS implmementation guide, // 2020-12-03 by Oliver Egger, copyright ahdis ag, Apache License, // FHIR: http://hl7.org/fhir/r4/. // ISSUE7: what are the URL's oid's we have to define. conceptmap "serviceMap" { prefix s = "http://fhir.ch/ig/ch-alis" prefix t = "http://hl7.org/fhir" s:TARMED == t:"urn:oid:2.16.756.5.30.1.129.1.4" s:ICD10 == t:"urn:oid:2.16.756.5.30.1.126.3.2" } conceptmap "gender" { prefix s = "http://fhir.ch/ig/ch-alis" prefix t = "http://hl7.org/fhir/ValueSet/administrative-gender" s:M == t:male s:F == t:female } conceptmap "laterality" { prefix s = "http://fhir.ch/ig/ch-alis" prefix t = "http://snomed.info/sct" s:l == t:"7771000" s:r == t:"24028007" s:b == t:"51440002" } uses "http://fhir.ch/ig/ch-alis/StructureDefinition/Header" alias Header as source uses "http://fhir.ch/ig/ch-alis/StructureDefinition/Visit" alias Visit as source uses "http://fhir.ch/ig/ch-alis/StructureDefinition/Service" alias Service as source uses "http://fhir.ch/ig/ch-alis/StructureDefinition/PersonV40" alias PersonV40 as source uses "http://fhir.ch/ig/ch-alis/StructureDefinition/ParameterV40" alias ParameterV40 as source uses "http://fhir.ch/ig/ch-alis/StructureDefinition/DiagGroup" alias DiagGroup as source uses "http://fhir.ch/ig/ch-alis/StructureDefinition/LeistungsschnittstelleProcedure" alias Proc as source uses "http://fhir.ch/ig/ch-alis/StructureDefinition/Diagnosis" alias Diagnosis as source uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as target uses "http://hl7.org/fhir/StructureDefinition/ChargeItem" alias ChargeItem as target uses "http://hl7.org/fhir/StructureDefinition/Extension" alias Extension as target uses "http://hl7.org/fhir/StructureDefinition/MessageHeader" alias MessageHeader as target uses "http://hl7.org/fhir/StructureDefinition/BackboneElement" alias BackboneElement as target uses "http://hl7.org/fhir/StructureDefinition/HumanName" alias HumanName as target uses "http://hl7.org/fhir/StructureDefinition/Condition" alias Condition as target uses "http://hl7.org/fhir/StructureDefinition/Encounter" alias Encounter as target uses "http://hl7.org/fhir/StructureDefinition/Procedure" alias Procedure as target group Alis43ToBundle(source header : Header, target bundle : Bundle) { header -> bundle.meta as meta, meta.profile as profile, profile.value = 'http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-message', bundle.entry as e, e.resource = create('MessageHeader') as messageHeader, messageHeader.id = uuid() as uuid, e.fullUrl = append('urn:uuid:', uuid), bundle.entry as e2, e2.resource = create('Bundle') as transactionBundle, transactionBundle.id = uuid() as uuid2, e2.fullUrl = append('urn:uuid:', uuid2), messageHeader.focus = create('Reference') as reference, reference.type = 'Bundle', reference.reference = append('urn:uuid:', uuid2) then { header then Alis43ToMessageHeader(header, messageHeader) "messageHeader"; header then Alis43ToBundleTransaction(header, transactionBundle) "bundleTransaction"; } "bundle"; header -> bundle.type = 'message' "type"; header.FileCreationDate as fileCreationDate then { fileCreationDate.data as date -> bundle.timestamp = date "date"; }; } group Alis43ToMessageHeader(source header : Header, target messageHeader : MessageHeader) { // ISSUE1: should be link to a MessageDefinition or a code? header -> messageHeader.event = create('uri') as value, value.value = 'http://fhir.ch/ig/ch-alis-43' "eventUri"; // ISSUE2: MessageControlID cannot be id of entry, needs to be either fullUrl oder uuid, need to map this to an identifier header -> messageHeader.source as source then { header.SoftwareReleaseNumber as version -> source.version = (%version.data) "version"; // ISSUE3: " : "urn:SendingApplication:SendingFacility:SendingServiceCode" -> add urn: in example/docu header -> source.endpoint = ('urn:' + %header.SendingApplication.data + ':' + %header.SendingFacility.data + ':' + %header.SendingServiceCode.data) "endpoint"; } "source"; header -> messageHeader.destination as destination then { // ISSUE4: " : "urn:ReceivingApplication, ReceivingFacility, ReceivingServiceCode" -> add urn: in example/docu header -> destination.endpoint = ('urn:' + %header.ReceivingApplication.data + ':' + %header.ReceivingFacility.data + ':' + %header.ReceivingServiceCode.data) "endpoint"; } "destination"; } group Alis43ToBundleTransaction(source header : Header, target transactionBundle : Bundle) { header -> transactionBundle.type = 'transaction' "transaction"; header.Visit as visit then { visit.Service as service -> transactionBundle.entry as e, e.resource = create('ChargeItem') as chargeItem then ServiceToChargeItem(service, visit, chargeItem, e) "ServiceToChargeItem"; }; } group ServiceToChargeItem(source service : Service, source visit : Visit, target chargeItem : ChargeItem, target entry) { service.ItemNumber as itemNumber -> chargeItem.id = (%itemNumber.data.lower()) as uuid, entry.fullUrl = append('urn:uuid:', uuid) "R311LaufnummerItemNumber"; service -> chargeItem.contained = create('Patient') as patient, patient.id = 'pat' as containedid, chargeItem.subject = create('Reference') as ref, ref.reference = ('#' + %containedid) then ServiceToPatient(service, visit, patient) "patient"; visit -> chargeItem.contained = create('Encounter') as encounter, encounter.id = 'enc' as containedid, chargeItem.context = create('Reference') as ref, ref.reference = ('#' + %containedid) then { visit then VisitToEncounter(visit, encounter) "VisitToEncounter"; service.Diagnosis as diag -> chargeItem.contained = create('Condition') as condition, condition.id = uuid() as containedid, encounter.diagnosis as diag, diag.condition = create('Reference') as ref, ref.reference = ('#' + %containedid) then DiagnosisToCondition(diag, condition) "DiagnosisToCondition"; } "encounter"; visit.DiagGroup as diaggroup -> chargeItem.contained = create('Condition') as cond, cond.id = 'cond' as containedid then DiagGroupToCondition(diaggroup, cond) "DiagGroupToCondition"; service where (service.Transaction.exists() = false) -> entry.request as request, request.method = 'POST', request.url = 'ChargeItem' "POSTDEFAULT"; service.Transaction where (service.Transaction = 'insert') -> entry.request as request, request.method = 'POST', request.url = 'ChargeItem' "POST"; service.Transaction where (service.Transaction = 'update') -> entry.request as request, request.method = 'PUT', request.url = 'ChargeItem' "UPDATE"; service.Transaction where (service.Transaction = 'delete') -> entry.request as request, request.method = 'DELETE', request.url = 'ChargeItem' "DELETE"; service.SessionID as sessionID -> chargeItem.extension as extension, extension.url = 'http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-ext-sessionid', extension.value = create('string') as value, value.value = (%sessionID.data) "R32SitzungSessionID"; service.OrderID as orderID -> chargeItem.extension as extension, extension.url = 'http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-ext-orderid', extension.value = create('string') as value, value.value = (%orderID.data) "R33AuftragsnummerOrderID"; service.OrderDate as orderDate -> chargeItem.extension as extension, extension.url = 'http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-ext-orderdate', extension.value = create('dateTime') as value, value.value = (%orderDate.data) "R33AuftragsnummerOrderID"; service.Form as form -> chargeItem.extension as extension, extension.url = 'http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-ext-form', extension.value = create('string') as value, value.value = (%form.data) "R37FormularbezeichnungForm"; service.ParameterV40 as parameterV40 -> chargeItem.extension as extension, extension.url = 'http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-ext-parameterv40' then ParameterV40ToExtension(parameterV40, extension) "R4ParamterV40ParameterV40"; service -> chargeItem.status = 'billable' "billable"; service.RefItemNumber as refItemNumber then { refItemNumber.data as data -> chargeItem.partOf = create('Reference') as ref, ref.reference = ('urn:uuid:' + %data.lower()), ref.type = 'ChargeItem' "R312ReferenzzuHauptleistungRefItemNumber"; }; service.ServiceItem as serviceItem then { serviceItem.data as data -> chargeItem.code = create('CodeableConcept') as cc, cc.coding = create('Coding') as coding, coding.code = data then { service.ServiceType as serviceType then { serviceType.data as data -> coding.system = translate(data, '#serviceMap', 'code') "R35KatalogServiceType"; } "servicType"; } "R36TarifpositionServiceItem"; } "R36Tarifposition"; service.ServiceDate as serviceData -> chargeItem.occurrence = create('dateTime') as occurrence, occurrence.value = (%serviceData.data) "R31LeistungsdatumServiceDate"; service.PersonV40 as personV40 -> chargeItem.performer = create('BackboneElement') as performer then PersonV40ToPerformer(personV40, performer) "R315PersonV40PersonV40"; service.ProviderID as providerID -> chargeItem.performingOrganization = create('Reference') as reference, reference.display = (%providerID.data) "R39ErbringendeOrganizationProviderID"; service.ReferrerID as referrerID -> chargeItem.costCenter = create('Reference') as reference, reference.display = (%referrerID.data) "R34AuftraggebendeKostenstelleReferrerID"; service.Quantity as quantity -> chargeItem.quantity = create('Quantity') as q, q.value as value, value.value = (%quantity.data) "R313AnzahlQuantity"; service.EnteredBy as enteredBy -> chargeItem.enterer = create('Reference') as reference, reference.display = (%enteredBy.data) "R310ErfasserEnteredBy"; service.EnteredDateTime as enteredDateTime -> chargeItem.enteredDate = create('dateTime') as enteredDate, enteredDate.value = (%enteredDateTime.data) "R38ErfassungsdatumEnteredDateTime"; service.PatientContactID as patientContactID then { patientContactID.data as data -> chargeItem.identifier = create('Identifier') as identifier, identifier.value = data "PatientContactID"; } "patientContactID"; service.Costweight as costweight then { costweight.data as data -> chargeItem.factorOverride = data "Costweight"; } "costweight"; service.Procedure as proc -> chargeItem.contained = create('Procedure') as procedure, procedure.id = uuid() as containedid, chargeItem.service = create('Reference') as service, service.reference = ('#' + %containedid) then ServiceProcedureToFhirProcedure(proc, procedure) "ServiceProcedureToFhirProcedure"; } group ServiceProcedureToFhirProcedure(source proc : Proc, target procedure : Procedure) { proc.Identifier as identifier -> procedure.identifier = create('Identifier') as identifier, identifier.value = (%identifier.data) "R314ProzedurIDIdentifier"; proc.Code as chopcode where (%proc.Category.data = 'CHOP_2023') -> procedure.code = create('CodeableConcept') as cc, cc.coding = create('Coding') as coding, coding.code = (%chopcode.data), coding.system = 'https://www.bfs.admin.ch/bfs/statistiche/catalog/chop2023', coding.display = (%proc.Display.data) "R316ProzedurcodeCode"; proc.PerformedDateTime as performedDateTime -> procedure.performed = (%performedDateTime.data) "R317DatumZeitPerformedDateTime"; proc.Laterality as laterality then { laterality.data as v -> procedure.bodySite = create('CodeableConcept') as cc, cc.coding = create('Coding') as coding, coding.code = translate(v, '#laterality', 'code'), coding.system = 'http://snomed.info/sct', coding.display = (%proc.LateralityDisplay.data) "R318SeiteLaterality"; } "laterality"; proc.Performer as performer then { // TODO Perfomer.function performer.Identifier as identifier then { identifier.data as data -> procedure.performer as performer, performer.actor as actor, actor.identifier as identifier, identifier.value = data "identifier"; }; } "performer"; proc -> procedure.subject = create('Reference') as ref, ref.reference = '#pat' "containedpatient"; proc -> procedure.status = 'completed' "status"; } group PersonV40ToPerformer(source personV40 : PersonV40, target performer) { personV40.PersonTyp as personTyp -> performer.function as cc, cc.coding as coding, coding.system as system, system.value = 'http://fhir.ch/ig/ch-alis/CodeSystem/ch-alis-persontyp', coding.code as code, code.value = personTyp "R3152PersonIDPersonID"; personV40.PersonID as personId -> performer.actor = create('Reference') as reference, reference.display = (%personId.data) "R3152PersonIDPersonID"; } group ParameterV40ToExtension(source parameterV40 : ParameterV40, target extension : Extension) { parameterV40.ParamTyp as paramTyp -> extension.extension as extInner then InnerExtensionParamTyp(paramTyp, extInner); parameterV40.ParamValue as paramValue then { paramValue.data as data -> extension.extension as extInner then InnerExtensionParamValue(data, extInner); }; } group InnerExtensionParamTyp(source src, target ext : Extension) { src -> ext.url = 'ParamTyp' "url"; src -> ext.value = create('CodeableConcept') as cc, cc.text as text, text.value = src "string"; } group InnerExtensionParamValue(source src, target ext : Extension) { src -> ext.url = 'ParamValue' "url"; src -> ext.value = create('string') as string, string.value = src "string"; } group ServiceToPatientName(source visit : Visit, target name : HumanName) { visit.PatientName as patientName then { patientName.data as data -> name.family = data "R23PatientNamePatientName"; } "patientName"; visit.PatientGivenName as patientGivenName then { patientGivenName.data as data -> name.given = data "R24PatientVornamePatientGivenName"; } "patientGivenName"; } group ServiceToPatient(source service : Service, source visit : Visit, target patient : Patient) { visit.PatientID as patientID then { patientID.data as patId -> patient.identifier as identifier, identifier.value as value, value.value = patId, identifier.system as idsystem, idsystem.value = 'http://www.example.ch/patienteniddomain', identifier.type as type, type.coding as coding, coding.system as system, system.value = 'http://terminology.hl7.org/CodeSystem/v2-0203', coding.code as code, code.value = 'MR' "R22PatientPIDPatientID"; } "patientID"; // <!-- 2.2 Patient.PID (PatientID) --> // <identifier> // <type> // <coding> // <system value="http://terminology.hl7.org/CodeSystem/v2-0203" /> // <code value="MR" /> // <display value="Medical record number"/> // </coding> // </type> // ISSUE8: what do with system value // <system value="http://www.example.ch/patienteniddomain"/> // <value value="Patienten-ID"/> // </identifier>// visit where (visit.PatientName or visit.PatientGivenName) -> patient.name as name then ServiceToPatientName(visit, name) "ServiceToPatient"; visit.PatientGender as gender then { gender.data as v -> patient.gender = translate(v, '#gender', 'code') "gender"; } "R26PatientGeschlechtPatientGender"; visit.PatientBirthDate as birthDate then { birthDate.data as v -> patient.birthDate = v "birthDate"; } "R25PatientGebDatumPatientBirthDate"; } group DiagnosisToCondition(source diagnosis : Diagnosis, target cond : Condition) { diagnosis -> cond.subject = create('Reference') as ref, ref.reference = '#pat' "containedpatient"; // * Identifier 0..1 http://fhir.ch/ig/ch-alis/StructureDefinition/Text "TODO" diagnosis.Identifier as identifier then { identifier.data as data -> cond.identifier as identifier, identifier.value = data "identifier"; }; diagnosis.Code as code -> cond.code = create('CodeableConcept') as cc, cc.coding = create('Coding') as coding, coding.code = (%code.data), coding.display = (%diagnosis.Display.data) then { diagnosis.Category as category then { category.data as data where (startsWith('ICD')) -> coding.system = 'http://hl7.org/fhir/sid/icd-10'; } "serviceType"; } "R316ProzedurcodeCode"; // TODO system is not yet correct diagnosis.OnsetDateTime as onsetDateTime -> cond.onset = (%onsetDateTime.data) "onsetDateTime"; diagnosis.Laterality as laterality then { laterality.data as v -> cond.bodySite = create('CodeableConcept') as cc, cc.coding = create('Coding') as coding, coding.code = translate(v, '#laterality', 'code'), coding.system = 'http://snomed.info/sct', coding.display = (%diagnosis.LateralityDisplay.data) "R318SeiteLaterality"; } "laterality"; } group DiagGroupToCondition(source diagGroup : DiagGroup, target cond : Condition) { diagGroup -> cond.subject = create('Reference') as ref, ref.reference = '#pat' "containedpatient"; diagGroup.DiagCode as data -> cond.code = create('CodeableConcept') as cc, cc.coding = create('Coding') as coding, coding.code = data then { diagGroup.DiagCatType as diagCatType then { diagCatType.data as data -> coding.system = translate(data, '#serviceMap', 'code') "R293KatalogtypDiagCatType"; } "serviceType"; } "R291DiagnosecodeDiagCode"; } group TerminationToExtension(source visit : Visit, target ext : Extension) { visit.TerminationVisit as visit then { visit.data as data -> ext.extension as ext1, ext1.url = 'TerminationVisit', ext1.value = create('date') as date, date.value = data "R27FallAbschlussTerminationVisit"; }; visit.TerminationReason as visit then { visit.data as data -> ext.extension as ext1, ext1.url = 'TerminationReason', ext1.value = create('string') as string, string.value = data "R28FallAbschlussgrundTerminationReason"; } "TerminationVisit"; } group VisitToEncounter(source visit : Visit, target encounter : Encounter) { visit where (visit.TerminationVisit or visit.TerminationReason) -> encounter.extension as ext, ext.url = 'http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-ext-termination' then TerminationToExtension(visit, ext) "TerminationToExtension"; visit.VisitNumber as visitNumber then { // ISSUE8: what to do with falldomain? <system value="http://www.example.ch/fallnummerdomain"/> visitNumber.data as data -> encounter.identifier = create('Identifier') as identifier, identifier.value as value, value.value = data, identifier.system as idsystem, idsystem.value = 'http://www.example.ch/fallnummerdomain', identifier.type as type, type.coding as coding, coding.system as system, system.value = 'http://terminology.hl7.org/CodeSystem/v2-0203', coding.code as code, code.value = 'VN' "R21FallVisitNumber"; } "encounterID"; visit -> encounter.status = 'finished' "Finished"; visit -> encounter.class as coding, coding.system as system, system.value = 'http://terminology.hl7.org/CodeSystem/v3-ActCode', coding.code as code, code.value = 'IMP', coding.display as display, display.value = 'inpatient encounter' "R21FallVisitNumber"; visit -> encounter.subject = create('Reference') as ref, ref.reference = '#pat' "subject"; visit.DiagGroup as diaggroup -> encounter.diagnosis as diag, diag.condition = create('Reference') as ref, ref.reference = '#cond' then { diaggroup.DiagType as diagType -> diag.use as use, use.text = (%diagType.data) "R292DiagnosetypDiagType"; } "R29DiagnoseGruppeDiagGroup"; }
{
"resourceType" : "StructureMap",
"id" : "Alis43ToBundle",
"meta" : {
"lastUpdated" : "2024-05-01T13:40:44.080+00:00"
},
"text" : {
"status" : "generated",
"div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n <pre>/// url = "http://fhir.ch/ig/ch-alis/StructureMap/Alis43ToBundle"\n/// name = "Alis43ToBundle"\n/// title = "null"\n/// status = "draft"\n\n// Convert ALIS43 XML to a Bundle according to the CH ALIS implmementation guide,\n// 2020-12-03 by Oliver Egger, copyright ahdis ag, Apache License,\n// FHIR: http://hl7.org/fhir/r4/.\n// ISSUE7: what are the URL's oid's we have to define.\n\nconceptmap "serviceMap" {\n prefix s = "http://fhir.ch/ig/ch-alis"\n prefix t = "http://hl7.org/fhir"\n\n s:TARMED == t:"urn:oid:2.16.756.5.30.1.129.1.4"\n s:ICD10 == t:"urn:oid:2.16.756.5.30.1.126.3.2"\n}\n\nconceptmap "gender" {\n prefix s = "http://fhir.ch/ig/ch-alis"\n prefix t = "http://hl7.org/fhir/ValueSet/administrative-gender"\n\n s:M == t:male\n s:F == t:female\n}\n\nconceptmap "laterality" {\n prefix s = "http://fhir.ch/ig/ch-alis"\n prefix t = "http://snomed.info/sct"\n\n s:l == t:"7771000"\n s:r == t:"24028007"\n s:b == t:"51440002"\n}\n\nuses "http://fhir.ch/ig/ch-alis/StructureDefinition/Header" alias Header as source\nuses "http://fhir.ch/ig/ch-alis/StructureDefinition/Visit" alias Visit as source\nuses "http://fhir.ch/ig/ch-alis/StructureDefinition/Service" alias Service as source\nuses "http://fhir.ch/ig/ch-alis/StructureDefinition/PersonV40" alias PersonV40 as source\nuses "http://fhir.ch/ig/ch-alis/StructureDefinition/ParameterV40" alias ParameterV40 as source\nuses "http://fhir.ch/ig/ch-alis/StructureDefinition/DiagGroup" alias DiagGroup as source\nuses "http://fhir.ch/ig/ch-alis/StructureDefinition/LeistungsschnittstelleProcedure" alias Proc as source\nuses "http://fhir.ch/ig/ch-alis/StructureDefinition/Diagnosis" alias Diagnosis as source\nuses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as target\nuses "http://hl7.org/fhir/StructureDefinition/ChargeItem" alias ChargeItem as target\nuses "http://hl7.org/fhir/StructureDefinition/Extension" alias Extension as target\nuses "http://hl7.org/fhir/StructureDefinition/MessageHeader" alias MessageHeader as target\nuses "http://hl7.org/fhir/StructureDefinition/BackboneElement" alias BackboneElement as target\nuses "http://hl7.org/fhir/StructureDefinition/HumanName" alias HumanName as target\nuses "http://hl7.org/fhir/StructureDefinition/Condition" alias Condition as target\nuses "http://hl7.org/fhir/StructureDefinition/Encounter" alias Encounter as target\nuses "http://hl7.org/fhir/StructureDefinition/Procedure" alias Procedure as target\n\ngroup Alis43ToBundle(source header : Header, target bundle : Bundle) {\n header -> bundle.meta as meta, meta.profile as profile, profile.value = 'http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-message', bundle.entry as e, e.resource = create('MessageHeader') as messageHeader, messageHeader.id = uuid() as uuid, e.fullUrl = append('urn:uuid:', uuid), bundle.entry as e2, e2.resource = create('Bundle') as transactionBundle, transactionBundle.id = uuid() as uuid2, e2.fullUrl = append('urn:uuid:', uuid2), messageHeader.focus = create('Reference') as reference, reference.type = 'Bundle', reference.reference = append('urn:uuid:', uuid2) then {\n header then Alis43ToMessageHeader(header, messageHeader) "messageHeader";\n header then Alis43ToBundleTransaction(header, transactionBundle) "bundleTransaction";\n } "bundle";\n header -> bundle.type = 'message' "type";\n header.FileCreationDate as fileCreationDate then {\n fileCreationDate.data as date -> bundle.timestamp = date "date";\n };\n}\n\ngroup Alis43ToMessageHeader(source header : Header, target messageHeader : MessageHeader) {\n // ISSUE1: should be link to a MessageDefinition or a code?\n header -> messageHeader.event = create('uri') as value, value.value = 'http://fhir.ch/ig/ch-alis-43' "eventUri";\n // ISSUE2: MessageControlID cannot be id of entry, needs to be either fullUrl oder uuid, need to map this to an identifier\n header -> messageHeader.source as source then {\n header.SoftwareReleaseNumber as version -> source.version = (%version.data) "version";\n // ISSUE3: " : "urn:SendingApplication:SendingFacility:SendingServiceCode" -> add urn: in example/docu\n header -> source.endpoint = ('urn:' + %header.SendingApplication.data + ':' + %header.SendingFacility.data + ':' + %header.SendingServiceCode.data) "endpoint";\n } "source";\n header -> messageHeader.destination as destination then {\n // ISSUE4: " : "urn:ReceivingApplication, ReceivingFacility, ReceivingServiceCode" -> add urn: in example/docu\n header -> destination.endpoint = ('urn:' + %header.ReceivingApplication.data + ':' + %header.ReceivingFacility.data + ':' + %header.ReceivingServiceCode.data) "endpoint";\n } "destination";\n}\n\ngroup Alis43ToBundleTransaction(source header : Header, target transactionBundle : Bundle) {\n header -> transactionBundle.type = 'transaction' "transaction";\n header.Visit as visit then {\n visit.Service as service -> transactionBundle.entry as e, e.resource = create('ChargeItem') as chargeItem then ServiceToChargeItem(service, visit, chargeItem, e) "ServiceToChargeItem";\n };\n}\n\ngroup ServiceToChargeItem(source service : Service, source visit : Visit, target chargeItem : ChargeItem, target entry) {\n service.ItemNumber as itemNumber -> chargeItem.id = (%itemNumber.data.lower()) as uuid, entry.fullUrl = append('urn:uuid:', uuid) "R311LaufnummerItemNumber";\n service -> chargeItem.contained = create('Patient') as patient, patient.id = 'pat' as containedid, chargeItem.subject = create('Reference') as ref, ref.reference = ('#' + %containedid) then ServiceToPatient(service, visit, patient) "patient";\n visit -> chargeItem.contained = create('Encounter') as encounter, encounter.id = 'enc' as containedid, chargeItem.context = create('Reference') as ref, ref.reference = ('#' + %containedid) then {\n visit then VisitToEncounter(visit, encounter) "VisitToEncounter";\n service.Diagnosis as diag -> chargeItem.contained = create('Condition') as condition, condition.id = uuid() as containedid, encounter.diagnosis as diag, diag.condition = create('Reference') as ref, ref.reference = ('#' + %containedid) then DiagnosisToCondition(diag, condition) "DiagnosisToCondition";\n } "encounter";\n visit.DiagGroup as diaggroup -> chargeItem.contained = create('Condition') as cond, cond.id = 'cond' as containedid then DiagGroupToCondition(diaggroup, cond) "DiagGroupToCondition";\n service where (service.Transaction.exists() = false) -> entry.request as request, request.method = 'POST', request.url = 'ChargeItem' "POSTDEFAULT";\n service.Transaction where (service.Transaction = 'insert') -> entry.request as request, request.method = 'POST', request.url = 'ChargeItem' "POST";\n service.Transaction where (service.Transaction = 'update') -> entry.request as request, request.method = 'PUT', request.url = 'ChargeItem' "UPDATE";\n service.Transaction where (service.Transaction = 'delete') -> entry.request as request, request.method = 'DELETE', request.url = 'ChargeItem' "DELETE";\n service.SessionID as sessionID -> chargeItem.extension as extension, extension.url = 'http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-ext-sessionid', extension.value = create('string') as value, value.value = (%sessionID.data) "R32SitzungSessionID";\n service.OrderID as orderID -> chargeItem.extension as extension, extension.url = 'http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-ext-orderid', extension.value = create('string') as value, value.value = (%orderID.data) "R33AuftragsnummerOrderID";\n service.OrderDate as orderDate -> chargeItem.extension as extension, extension.url = 'http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-ext-orderdate', extension.value = create('dateTime') as value, value.value = (%orderDate.data) "R33AuftragsnummerOrderID";\n service.Form as form -> chargeItem.extension as extension, extension.url = 'http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-ext-form', extension.value = create('string') as value, value.value = (%form.data) "R37FormularbezeichnungForm";\n service.ParameterV40 as parameterV40 -> chargeItem.extension as extension, extension.url = 'http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-ext-parameterv40' then ParameterV40ToExtension(parameterV40, extension) "R4ParamterV40ParameterV40";\n service -> chargeItem.status = 'billable' "billable";\n service.RefItemNumber as refItemNumber then {\n refItemNumber.data as data -> chargeItem.partOf = create('Reference') as ref, ref.reference = ('urn:uuid:' + %data.lower()), ref.type = 'ChargeItem' "R312ReferenzzuHauptleistungRefItemNumber";\n };\n service.ServiceItem as serviceItem then {\n serviceItem.data as data -> chargeItem.code = create('CodeableConcept') as cc, cc.coding = create('Coding') as coding, coding.code = data then {\n service.ServiceType as serviceType then {\n serviceType.data as data -> coding.system = translate(data, '#serviceMap', 'code') "R35KatalogServiceType";\n } "servicType";\n } "R36TarifpositionServiceItem";\n } "R36Tarifposition";\n service.ServiceDate as serviceData -> chargeItem.occurrence = create('dateTime') as occurrence, occurrence.value = (%serviceData.data) "R31LeistungsdatumServiceDate";\n service.PersonV40 as personV40 -> chargeItem.performer = create('BackboneElement') as performer then PersonV40ToPerformer(personV40, performer) "R315PersonV40PersonV40";\n service.ProviderID as providerID -> chargeItem.performingOrganization = create('Reference') as reference, reference.display = (%providerID.data) "R39ErbringendeOrganizationProviderID";\n service.ReferrerID as referrerID -> chargeItem.costCenter = create('Reference') as reference, reference.display = (%referrerID.data) "R34AuftraggebendeKostenstelleReferrerID";\n service.Quantity as quantity -> chargeItem.quantity = create('Quantity') as q, q.value as value, value.value = (%quantity.data) "R313AnzahlQuantity";\n service.EnteredBy as enteredBy -> chargeItem.enterer = create('Reference') as reference, reference.display = (%enteredBy.data) "R310ErfasserEnteredBy";\n service.EnteredDateTime as enteredDateTime -> chargeItem.enteredDate = create('dateTime') as enteredDate, enteredDate.value = (%enteredDateTime.data) "R38ErfassungsdatumEnteredDateTime";\n service.PatientContactID as patientContactID then {\n patientContactID.data as data -> chargeItem.identifier = create('Identifier') as identifier, identifier.value = data "PatientContactID";\n } "patientContactID";\n service.Costweight as costweight then {\n costweight.data as data -> chargeItem.factorOverride = data "Costweight";\n } "costweight";\n service.Procedure as proc -> chargeItem.contained = create('Procedure') as procedure, procedure.id = uuid() as containedid, chargeItem.service = create('Reference') as service, service.reference = ('#' + %containedid) then ServiceProcedureToFhirProcedure(proc, procedure) "ServiceProcedureToFhirProcedure";\n}\n\ngroup ServiceProcedureToFhirProcedure(source proc : Proc, target procedure : Procedure) {\n proc.Identifier as identifier -> procedure.identifier = create('Identifier') as identifier, identifier.value = (%identifier.data) "R314ProzedurIDIdentifier";\n proc.Code as chopcode where (%proc.Category.data = 'CHOP_2023') -> procedure.code = create('CodeableConcept') as cc, cc.coding = create('Coding') as coding, coding.code = (%chopcode.data), coding.system = 'https://www.bfs.admin.ch/bfs/statistiche/catalog/chop2023', coding.display = (%proc.Display.data) "R316ProzedurcodeCode";\n proc.PerformedDateTime as performedDateTime -> procedure.performed = (%performedDateTime.data) "R317DatumZeitPerformedDateTime";\n proc.Laterality as laterality then {\n laterality.data as v -> procedure.bodySite = create('CodeableConcept') as cc, cc.coding = create('Coding') as coding, coding.code = translate(v, '#laterality', 'code'), coding.system = 'http://snomed.info/sct', coding.display = (%proc.LateralityDisplay.data) "R318SeiteLaterality";\n } "laterality";\n proc.Performer as performer then {\n // TODO Perfomer.function\n performer.Identifier as identifier then {\n identifier.data as data -> procedure.performer as performer, performer.actor as actor, actor.identifier as identifier, identifier.value = data "identifier";\n };\n } "performer";\n proc -> procedure.subject = create('Reference') as ref, ref.reference = '#pat' "containedpatient";\n proc -> procedure.status = 'completed' "status";\n}\n\ngroup PersonV40ToPerformer(source personV40 : PersonV40, target performer) {\n personV40.PersonTyp as personTyp -> performer.function as cc, cc.coding as coding, coding.system as system, system.value = 'http://fhir.ch/ig/ch-alis/CodeSystem/ch-alis-persontyp', coding.code as code, code.value = personTyp "R3152PersonIDPersonID";\n personV40.PersonID as personId -> performer.actor = create('Reference') as reference, reference.display = (%personId.data) "R3152PersonIDPersonID";\n}\n\ngroup ParameterV40ToExtension(source parameterV40 : ParameterV40, target extension : Extension) {\n parameterV40.ParamTyp as paramTyp -> extension.extension as extInner then InnerExtensionParamTyp(paramTyp, extInner);\n parameterV40.ParamValue as paramValue then {\n paramValue.data as data -> extension.extension as extInner then InnerExtensionParamValue(data, extInner);\n };\n}\n\ngroup InnerExtensionParamTyp(source src, target ext : Extension) {\n src -> ext.url = 'ParamTyp' "url";\n src -> ext.value = create('CodeableConcept') as cc, cc.text as text, text.value = src "string";\n}\n\ngroup InnerExtensionParamValue(source src, target ext : Extension) {\n src -> ext.url = 'ParamValue' "url";\n src -> ext.value = create('string') as string, string.value = src "string";\n}\n\ngroup ServiceToPatientName(source visit : Visit, target name : HumanName) {\n visit.PatientName as patientName then {\n patientName.data as data -> name.family = data "R23PatientNamePatientName";\n } "patientName";\n visit.PatientGivenName as patientGivenName then {\n patientGivenName.data as data -> name.given = data "R24PatientVornamePatientGivenName";\n } "patientGivenName";\n}\n\ngroup ServiceToPatient(source service : Service, source visit : Visit, target patient : Patient) {\n visit.PatientID as patientID then {\n patientID.data as patId -> patient.identifier as identifier, identifier.value as value, value.value = patId, identifier.system as idsystem, idsystem.value = 'http://www.example.ch/patienteniddomain', identifier.type as type, type.coding as coding, coding.system as system, system.value = 'http://terminology.hl7.org/CodeSystem/v2-0203', coding.code as code, code.value = 'MR' "R22PatientPIDPatientID";\n } "patientID";\n // <!-- 2.2 Patient.PID (PatientID) -->\n // <identifier>\n // <type>\n // <coding>\n // <system value="http://terminology.hl7.org/CodeSystem/v2-0203" />\n // <code value="MR" />\n // <display value="Medical record number"/>\n // </coding>\n // </type>\n // ISSUE8: what do with system value\n // <system value="http://www.example.ch/patienteniddomain"/>\n // <value value="Patienten-ID"/>\n // </identifier>//\n visit where (visit.PatientName or visit.PatientGivenName) -> patient.name as name then ServiceToPatientName(visit, name) "ServiceToPatient";\n visit.PatientGender as gender then {\n gender.data as v -> patient.gender = translate(v, '#gender', 'code') "gender";\n } "R26PatientGeschlechtPatientGender";\n visit.PatientBirthDate as birthDate then {\n birthDate.data as v -> patient.birthDate = v "birthDate";\n } "R25PatientGebDatumPatientBirthDate";\n}\n\ngroup DiagnosisToCondition(source diagnosis : Diagnosis, target cond : Condition) {\n diagnosis -> cond.subject = create('Reference') as ref, ref.reference = '#pat' "containedpatient";\n // * Identifier 0..1 http://fhir.ch/ig/ch-alis/StructureDefinition/Text "TODO"\n diagnosis.Identifier as identifier then {\n identifier.data as data -> cond.identifier as identifier, identifier.value = data "identifier";\n };\n diagnosis.Code as code -> cond.code = create('CodeableConcept') as cc, cc.coding = create('Coding') as coding, coding.code = (%code.data), coding.display = (%diagnosis.Display.data) then {\n diagnosis.Category as category then {\n category.data as data where (startsWith('ICD')) -> coding.system = 'http://hl7.org/fhir/sid/icd-10';\n } "serviceType";\n } "R316ProzedurcodeCode";\n // TODO system is not yet correct\n diagnosis.OnsetDateTime as onsetDateTime -> cond.onset = (%onsetDateTime.data) "onsetDateTime";\n diagnosis.Laterality as laterality then {\n laterality.data as v -> cond.bodySite = create('CodeableConcept') as cc, cc.coding = create('Coding') as coding, coding.code = translate(v, '#laterality', 'code'), coding.system = 'http://snomed.info/sct', coding.display = (%diagnosis.LateralityDisplay.data) "R318SeiteLaterality";\n } "laterality";\n}\n\ngroup DiagGroupToCondition(source diagGroup : DiagGroup, target cond : Condition) {\n diagGroup -> cond.subject = create('Reference') as ref, ref.reference = '#pat' "containedpatient";\n diagGroup.DiagCode as data -> cond.code = create('CodeableConcept') as cc, cc.coding = create('Coding') as coding, coding.code = data then {\n diagGroup.DiagCatType as diagCatType then {\n diagCatType.data as data -> coding.system = translate(data, '#serviceMap', 'code') "R293KatalogtypDiagCatType";\n } "serviceType";\n } "R291DiagnosecodeDiagCode";\n}\n\ngroup TerminationToExtension(source visit : Visit, target ext : Extension) {\n visit.TerminationVisit as visit then {\n visit.data as data -> ext.extension as ext1, ext1.url = 'TerminationVisit', ext1.value = create('date') as date, date.value = data "R27FallAbschlussTerminationVisit";\n };\n visit.TerminationReason as visit then {\n visit.data as data -> ext.extension as ext1, ext1.url = 'TerminationReason', ext1.value = create('string') as string, string.value = data "R28FallAbschlussgrundTerminationReason";\n } "TerminationVisit";\n}\n\ngroup VisitToEncounter(source visit : Visit, target encounter : Encounter) {\n visit where (visit.TerminationVisit or visit.TerminationReason) -> encounter.extension as ext, ext.url = 'http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-ext-termination' then TerminationToExtension(visit, ext) "TerminationToExtension";\n visit.VisitNumber as visitNumber then {\n // ISSUE8: what to do with falldomain? <system value="http://www.example.ch/fallnummerdomain"/>\n visitNumber.data as data -> encounter.identifier = create('Identifier') as identifier, identifier.value as value, value.value = data, identifier.system as idsystem, idsystem.value = 'http://www.example.ch/fallnummerdomain', identifier.type as type, type.coding as coding, coding.system as system, system.value = 'http://terminology.hl7.org/CodeSystem/v2-0203', coding.code as code, code.value = 'VN' "R21FallVisitNumber";\n } "encounterID";\n visit -> encounter.status = 'finished' "Finished";\n visit -> encounter.class as coding, coding.system as system, system.value = 'http://terminology.hl7.org/CodeSystem/v3-ActCode', coding.code as code, code.value = 'IMP', coding.display as display, display.value = 'inpatient encounter' "R21FallVisitNumber";\n visit -> encounter.subject = create('Reference') as ref, ref.reference = '#pat' "subject";\n visit.DiagGroup as diaggroup -> encounter.diagnosis as diag, diag.condition = create('Reference') as ref, ref.reference = '#cond' then {\n diaggroup.DiagType as diagType -> diag.use as use, use.text = (%diagType.data) "R292DiagnosetypDiagType";\n } "R29DiagnoseGruppeDiagGroup";\n}\n\n</pre>\n </div>"
},
"contained" : [
{
"resourceType" : "ConceptMap",
"id" : "serviceMap",
"status" : "draft",
"group" : [
{
"source" : "http://fhir.ch/ig/ch-alis",
"target" : "http://hl7.org/fhir",
"element" : [
{
"code" : "TARMED",
"target" : [
{
"code" : "urn:oid:2.16.756.5.30.1.129.1.4",
"equivalence" : "equivalent"
}
]
},
{
"code" : "ICD10",
"target" : [
{
"code" : "urn:oid:2.16.756.5.30.1.126.3.2",
"equivalence" : "equivalent"
}
]
}
]
}
]
},
{
"resourceType" : "ConceptMap",
"id" : "gender",
"status" : "draft",
"group" : [
{
"source" : "http://fhir.ch/ig/ch-alis",
"target" : "http://hl7.org/fhir/ValueSet/administrative-gender",
"element" : [
{
"code" : "M",
"target" : [
{
"code" : "male",
"equivalence" : "equivalent"
}
]
},
{
"code" : "F",
"target" : [
{
"code" : "female",
"equivalence" : "equivalent"
}
]
}
]
}
]
},
{
"resourceType" : "ConceptMap",
"id" : "laterality",
"status" : "draft",
"group" : [
{
"source" : "http://fhir.ch/ig/ch-alis",
"target" : "http://snomed.info/sct",
"element" : [
{
"code" : "l",
"target" : [
{
"code" : "7771000",
"equivalence" : "equivalent"
}
]
},
{
"code" : "r",
"target" : [
{
"code" : "24028007",
"equivalence" : "equivalent"
}
]
},
{
"code" : "b",
"target" : [
{
"code" : "51440002",
"equivalence" : "equivalent"
}
]
}
]
}
]
}
],
"url" : "http://fhir.ch/ig/ch-alis/StructureMap/Alis43ToBundle",
"version" : "0.3.0",
"name" : "Alis43ToBundle",
"status" : "draft",
"date" : "2024-10-29T15:42:46+00:00",
"publisher" : "ALIS-Connect",
"contact" : [
{
"name" : "ALIS-Connect",
"telecom" : [
{
"system" : "url",
"value" : "https://www.alis-connect.ch/"
}
]
}
],
"description" : "Convert ALIS43 XML to a Bundle according to the CH ALIS implmementation guide,\r\n2020-12-03 by Oliver Egger, copyright ahdis ag, Apache License,\r\nFHIR: http://hl7.org/fhir/r4/.\r\nISSUE7: what are the URL's oid's we have to define.",
"jurisdiction" : [
{
"coding" : [
{
"system" : "urn:iso:std:iso:3166",
"code" : "CH"
}
]
}
],
"copyright" : "not-open-source",
"structure" : [
{
"url" : "http://fhir.ch/ig/ch-alis/StructureDefinition/Header",
"mode" : "source",
"alias" : "Header"
},
{
"url" : "http://fhir.ch/ig/ch-alis/StructureDefinition/Visit",
"mode" : "source",
"alias" : "Visit"
},
{
"url" : "http://fhir.ch/ig/ch-alis/StructureDefinition/Service",
"mode" : "source",
"alias" : "Service"
},
{
"url" : "http://fhir.ch/ig/ch-alis/StructureDefinition/PersonV40",
"mode" : "source",
"alias" : "PersonV40"
},
{
"url" : "http://fhir.ch/ig/ch-alis/StructureDefinition/ParameterV40",
"mode" : "source",
"alias" : "ParameterV40"
},
{
"url" : "http://fhir.ch/ig/ch-alis/StructureDefinition/DiagGroup",
"mode" : "source",
"alias" : "DiagGroup"
},
{
"url" : "http://fhir.ch/ig/ch-alis/StructureDefinition/LeistungsschnittstelleProcedure",
"mode" : "source",
"alias" : "Proc"
},
{
"url" : "http://fhir.ch/ig/ch-alis/StructureDefinition/Diagnosis",
"mode" : "source",
"alias" : "Diagnosis"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Bundle",
"mode" : "target",
"alias" : "Bundle"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/ChargeItem",
"mode" : "target",
"alias" : "ChargeItem"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Extension",
"mode" : "target",
"alias" : "Extension"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/MessageHeader",
"mode" : "target",
"alias" : "MessageHeader"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/BackboneElement",
"mode" : "target",
"alias" : "BackboneElement"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/HumanName",
"mode" : "target",
"alias" : "HumanName"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Condition",
"mode" : "target",
"alias" : "Condition"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Encounter",
"mode" : "target",
"alias" : "Encounter"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Procedure",
"mode" : "target",
"alias" : "Procedure"
}
],
"group" : [
{
"name" : "Alis43ToBundle",
"typeMode" : "none",
"input" : [
{
"name" : "header",
"type" : "Header",
"mode" : "source"
},
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "target"
}
],
"rule" : [
{
"name" : "bundle",
"source" : [
{
"context" : "header"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "meta",
"variable" : "meta"
},
{
"context" : "meta",
"contextType" : "variable",
"element" : "profile",
"variable" : "profile"
},
{
"context" : "profile",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-message"
}
]
},
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e"
},
{
"context" : "e",
"contextType" : "variable",
"element" : "resource",
"variable" : "messageHeader",
"transform" : "create",
"parameter" : [
{
"valueString" : "MessageHeader"
}
]
},
{
"context" : "messageHeader",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid",
"transform" : "uuid"
},
{
"context" : "e",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid"
}
]
},
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e2"
},
{
"context" : "e2",
"contextType" : "variable",
"element" : "resource",
"variable" : "transactionBundle",
"transform" : "create",
"parameter" : [
{
"valueString" : "Bundle"
}
]
},
{
"context" : "transactionBundle",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid2",
"transform" : "uuid"
},
{
"context" : "e2",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid2"
}
]
},
{
"context" : "messageHeader",
"contextType" : "variable",
"element" : "focus",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "type",
"transform" : "copy",
"parameter" : [
{
"valueString" : "Bundle"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid2"
}
]
}
],
"rule" : [
{
"name" : "messageHeader",
"source" : [
{
"context" : "header"
}
],
"dependent" : [
{
"name" : "Alis43ToMessageHeader",
"variable" : [
"header",
"messageHeader"
]
}
]
},
{
"name" : "bundleTransaction",
"source" : [
{
"context" : "header"
}
],
"dependent" : [
{
"name" : "Alis43ToBundleTransaction",
"variable" : [
"header",
"transactionBundle"
]
}
]
}
]
},
{
"name" : "type",
"source" : [
{
"context" : "header"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "type",
"transform" : "copy",
"parameter" : [
{
"valueString" : "message"
}
]
}
]
},
{
"name" : "FileCreationDate",
"source" : [
{
"context" : "header",
"element" : "FileCreationDate",
"variable" : "fileCreationDate"
}
],
"rule" : [
{
"name" : "date",
"source" : [
{
"context" : "fileCreationDate",
"element" : "data",
"variable" : "date"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "timestamp",
"transform" : "copy",
"parameter" : [
{
"valueId" : "date"
}
]
}
]
}
]
}
]
},
{
"name" : "Alis43ToMessageHeader",
"typeMode" : "none",
"input" : [
{
"name" : "header",
"type" : "Header",
"mode" : "source"
},
{
"name" : "messageHeader",
"type" : "MessageHeader",
"mode" : "target"
}
],
"rule" : [
{
"name" : "eventUri",
"source" : [
{
"context" : "header"
}
],
"target" : [
{
"context" : "messageHeader",
"contextType" : "variable",
"element" : "event",
"variable" : "value",
"transform" : "create",
"parameter" : [
{
"valueString" : "uri"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-alis-43"
}
]
}
]
},
{
"name" : "source",
"source" : [
{
"context" : "header"
}
],
"target" : [
{
"context" : "messageHeader",
"contextType" : "variable",
"element" : "source",
"variable" : "source"
}
],
"rule" : [
{
"name" : "version",
"source" : [
{
"context" : "header",
"element" : "SoftwareReleaseNumber",
"variable" : "version"
}
],
"target" : [
{
"context" : "source",
"contextType" : "variable",
"element" : "version",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%version.data"
}
]
}
]
},
{
"name" : "endpoint",
"source" : [
{
"context" : "header"
}
],
"target" : [
{
"context" : "source",
"contextType" : "variable",
"element" : "endpoint",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:' + %header.SendingApplication.data + ':' + %header.SendingFacility.data + ':' + %header.SendingServiceCode.data"
}
]
}
]
}
]
},
{
"name" : "destination",
"source" : [
{
"context" : "header"
}
],
"target" : [
{
"context" : "messageHeader",
"contextType" : "variable",
"element" : "destination",
"variable" : "destination"
}
],
"rule" : [
{
"name" : "endpoint",
"source" : [
{
"context" : "header"
}
],
"target" : [
{
"context" : "destination",
"contextType" : "variable",
"element" : "endpoint",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:' + %header.ReceivingApplication.data + ':' + %header.ReceivingFacility.data + ':' + %header.ReceivingServiceCode.data"
}
]
}
]
}
]
}
]
},
{
"name" : "Alis43ToBundleTransaction",
"typeMode" : "none",
"input" : [
{
"name" : "header",
"type" : "Header",
"mode" : "source"
},
{
"name" : "transactionBundle",
"type" : "Bundle",
"mode" : "target"
}
],
"rule" : [
{
"name" : "transaction",
"source" : [
{
"context" : "header"
}
],
"target" : [
{
"context" : "transactionBundle",
"contextType" : "variable",
"element" : "type",
"transform" : "copy",
"parameter" : [
{
"valueString" : "transaction"
}
]
}
]
},
{
"name" : "Visit",
"source" : [
{
"context" : "header",
"element" : "Visit",
"variable" : "visit"
}
],
"rule" : [
{
"name" : "ServiceToChargeItem",
"source" : [
{
"context" : "visit",
"element" : "Service",
"variable" : "service"
}
],
"target" : [
{
"context" : "transactionBundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e"
},
{
"context" : "e",
"contextType" : "variable",
"element" : "resource",
"variable" : "chargeItem",
"transform" : "create",
"parameter" : [
{
"valueString" : "ChargeItem"
}
]
}
],
"dependent" : [
{
"name" : "ServiceToChargeItem",
"variable" : [
"service",
"visit",
"chargeItem",
"e"
]
}
]
}
]
}
]
},
{
"name" : "ServiceToChargeItem",
"typeMode" : "none",
"input" : [
{
"name" : "service",
"type" : "Service",
"mode" : "source"
},
{
"name" : "visit",
"type" : "Visit",
"mode" : "source"
},
{
"name" : "chargeItem",
"type" : "ChargeItem",
"mode" : "target"
},
{
"name" : "entry",
"mode" : "target"
}
],
"rule" : [
{
"name" : "R311LaufnummerItemNumber",
"source" : [
{
"context" : "service",
"element" : "ItemNumber",
"variable" : "itemNumber"
}
],
"target" : [
{
"context" : "chargeItem",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%itemNumber.data.lower()"
}
]
},
{
"context" : "entry",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid"
}
]
}
]
},
{
"name" : "patient",
"source" : [
{
"context" : "service"
}
],
"target" : [
{
"context" : "chargeItem",
"contextType" : "variable",
"element" : "contained",
"variable" : "patient",
"transform" : "create",
"parameter" : [
{
"valueString" : "Patient"
}
]
},
{
"context" : "patient",
"contextType" : "variable",
"element" : "id",
"variable" : "containedid",
"transform" : "copy",
"parameter" : [
{
"valueString" : "pat"
}
]
},
{
"context" : "chargeItem",
"contextType" : "variable",
"element" : "subject",
"variable" : "ref",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "ref",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'#' + %containedid"
}
]
}
],
"dependent" : [
{
"name" : "ServiceToPatient",
"variable" : [
"service",
"visit",
"patient"
]
}
]
},
{
"name" : "encounter",
"source" : [
{
"context" : "visit"
}
],
"target" : [
{
"context" : "chargeItem",
"contextType" : "variable",
"element" : "contained",
"variable" : "encounter",
"transform" : "create",
"parameter" : [
{
"valueString" : "Encounter"
}
]
},
{
"context" : "encounter",
"contextType" : "variable",
"element" : "id",
"variable" : "containedid",
"transform" : "copy",
"parameter" : [
{
"valueString" : "enc"
}
]
},
{
"context" : "chargeItem",
"contextType" : "variable",
"element" : "context",
"variable" : "ref",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "ref",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'#' + %containedid"
}
]
}
],
"rule" : [
{
"name" : "VisitToEncounter",
"source" : [
{
"context" : "visit"
}
],
"dependent" : [
{
"name" : "VisitToEncounter",
"variable" : [
"visit",
"encounter"
]
}
]
},
{
"name" : "DiagnosisToCondition",
"source" : [
{
"context" : "service",
"element" : "Diagnosis",
"variable" : "diag"
}
],
"target" : [
{
"context" : "chargeItem",
"contextType" : "variable",
"element" : "contained",
"variable" : "condition",
"transform" : "create",
"parameter" : [
{
"valueString" : "Condition"
}
]
},
{
"context" : "condition",
"contextType" : "variable",
"element" : "id",
"variable" : "containedid",
"transform" : "uuid"
},
{
"context" : "encounter",
"contextType" : "variable",
"element" : "diagnosis",
"variable" : "diag"
},
{
"context" : "diag",
"contextType" : "variable",
"element" : "condition",
"variable" : "ref",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "ref",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'#' + %containedid"
}
]
}
],
"dependent" : [
{
"name" : "DiagnosisToCondition",
"variable" : [
"diag",
"condition"
]
}
]
}
]
},
{
"name" : "DiagGroupToCondition",
"source" : [
{
"context" : "visit",
"element" : "DiagGroup",
"variable" : "diaggroup"
}
],
"target" : [
{
"context" : "chargeItem",
"contextType" : "variable",
"element" : "contained",
"variable" : "cond",
"transform" : "create",
"parameter" : [
{
"valueString" : "Condition"
}
]
},
{
"context" : "cond",
"contextType" : "variable",
"element" : "id",
"variable" : "containedid",
"transform" : "copy",
"parameter" : [
{
"valueString" : "cond"
}
]
}
],
"dependent" : [
{
"name" : "DiagGroupToCondition",
"variable" : [
"diaggroup",
"cond"
]
}
]
},
{
"name" : "POSTDEFAULT",
"source" : [
{
"context" : "service",
"condition" : "(service.Transaction.exists() = false)"
}
],
"target" : [
{
"context" : "entry",
"contextType" : "variable",
"element" : "request",
"variable" : "request"
},
{
"context" : "request",
"contextType" : "variable",
"element" : "method",
"transform" : "copy",
"parameter" : [
{
"valueString" : "POST"
}
]
},
{
"context" : "request",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "ChargeItem"
}
]
}
]
},
{
"name" : "POST",
"source" : [
{
"context" : "service",
"element" : "Transaction",
"condition" : "(service.Transaction = 'insert')"
}
],
"target" : [
{
"context" : "entry",
"contextType" : "variable",
"element" : "request",
"variable" : "request"
},
{
"context" : "request",
"contextType" : "variable",
"element" : "method",
"transform" : "copy",
"parameter" : [
{
"valueString" : "POST"
}
]
},
{
"context" : "request",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "ChargeItem"
}
]
}
]
},
{
"name" : "UPDATE",
"source" : [
{
"context" : "service",
"element" : "Transaction",
"condition" : "(service.Transaction = 'update')"
}
],
"target" : [
{
"context" : "entry",
"contextType" : "variable",
"element" : "request",
"variable" : "request"
},
{
"context" : "request",
"contextType" : "variable",
"element" : "method",
"transform" : "copy",
"parameter" : [
{
"valueString" : "PUT"
}
]
},
{
"context" : "request",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "ChargeItem"
}
]
}
]
},
{
"name" : "DELETE",
"source" : [
{
"context" : "service",
"element" : "Transaction",
"condition" : "(service.Transaction = 'delete')"
}
],
"target" : [
{
"context" : "entry",
"contextType" : "variable",
"element" : "request",
"variable" : "request"
},
{
"context" : "request",
"contextType" : "variable",
"element" : "method",
"transform" : "copy",
"parameter" : [
{
"valueString" : "DELETE"
}
]
},
{
"context" : "request",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "ChargeItem"
}
]
}
]
},
{
"name" : "R32SitzungSessionID",
"source" : [
{
"context" : "service",
"element" : "SessionID",
"variable" : "sessionID"
}
],
"target" : [
{
"context" : "chargeItem",
"contextType" : "variable",
"element" : "extension",
"variable" : "extension"
},
{
"context" : "extension",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-ext-sessionid"
}
]
},
{
"context" : "extension",
"contextType" : "variable",
"element" : "value",
"variable" : "value",
"transform" : "create",
"parameter" : [
{
"valueString" : "string"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%sessionID.data"
}
]
}
]
},
{
"name" : "R33AuftragsnummerOrderID",
"source" : [
{
"context" : "service",
"element" : "OrderID",
"variable" : "orderID"
}
],
"target" : [
{
"context" : "chargeItem",
"contextType" : "variable",
"element" : "extension",
"variable" : "extension"
},
{
"context" : "extension",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-ext-orderid"
}
]
},
{
"context" : "extension",
"contextType" : "variable",
"element" : "value",
"variable" : "value",
"transform" : "create",
"parameter" : [
{
"valueString" : "string"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%orderID.data"
}
]
}
]
},
{
"name" : "R33AuftragsnummerOrderID",
"source" : [
{
"context" : "service",
"element" : "OrderDate",
"variable" : "orderDate"
}
],
"target" : [
{
"context" : "chargeItem",
"contextType" : "variable",
"element" : "extension",
"variable" : "extension"
},
{
"context" : "extension",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-ext-orderdate"
}
]
},
{
"context" : "extension",
"contextType" : "variable",
"element" : "value",
"variable" : "value",
"transform" : "create",
"parameter" : [
{
"valueString" : "dateTime"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%orderDate.data"
}
]
}
]
},
{
"name" : "R37FormularbezeichnungForm",
"source" : [
{
"context" : "service",
"element" : "Form",
"variable" : "form"
}
],
"target" : [
{
"context" : "chargeItem",
"contextType" : "variable",
"element" : "extension",
"variable" : "extension"
},
{
"context" : "extension",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-ext-form"
}
]
},
{
"context" : "extension",
"contextType" : "variable",
"element" : "value",
"variable" : "value",
"transform" : "create",
"parameter" : [
{
"valueString" : "string"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%form.data"
}
]
}
]
},
{
"name" : "R4ParamterV40ParameterV40",
"source" : [
{
"context" : "service",
"element" : "ParameterV40",
"variable" : "parameterV40"
}
],
"target" : [
{
"context" : "chargeItem",
"contextType" : "variable",
"element" : "extension",
"variable" : "extension"
},
{
"context" : "extension",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-alis/StructureDefinition/ch-alis-ext-parameterv40"
}
]
}
],
"dependent" : [
{
"name" : "ParameterV40ToExtension",
"variable" : [
"parameterV40",
"extension"
]
}
]
},
{
"name" : "billable",
"source" : [
{
"context" : "service"
}
],
"target" : [
{
"context" : "chargeItem",
"contextType" : "variable",
"element" : "status",
"transform" : "copy",
"parameter" : [
{
"valueString" : "billable"
}
]
}
]
},
{
"name" : "RefItemNumber",
"source" : [
{
"context" : "service",
"element" : "RefItemNumber",
"variable" : "refItemNumber"
}
],
"rule" : [
{
"name" : "R312ReferenzzuHauptleistungRefItemNumber",
"source" : [
{
"context" : "refItemNumber",
"element" : "data",
"variable" : "data"
}
],
"target" : [
{
"context" : "chargeItem",
"contextType" : "variable",
"element" : "partOf",
"variable" : "ref",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "ref",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %data.lower()"
}
]
},
{
"context" : "ref",
"contextType" : "variable",
"element" : "type",
"transform" : "copy",
"parameter" : [
{
"valueString" : "ChargeItem"
}
]
}
]
}
]
},
{
"name" : "R36Tarifposition",
"source" : [
{
"context" : "service",
"element" : "ServiceItem",
"variable" : "serviceItem"
}
],
"rule" : [
{
"name" : "R36TarifpositionServiceItem",
"source" : [
{
"context" : "serviceItem",
"element" : "data",
"variable" : "data"
}
],
"target" : [
{
"context" : "chargeItem",
"contextType" : "variable",
"element" : "code",
"variable" : "cc",
"transform" : "create",
"parameter" : [
{
"valueString" : "CodeableConcept"
}
]
},
{
"context" : "cc",
"contextType" : "variable",
"element" : "coding",
"variable" : "coding",
"transform" : "create",
"parameter" : [
{
"valueString" : "Coding"
}
]
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueId" : "data"
}
]
}
],
"rule" : [
{
"name" : "servicType",
"source" : [
{
"context" : "service",
"element" : "ServiceType",
"variable" : "serviceType"
}
],
"rule" : [
{
"name" : "R35KatalogServiceType",
"source" : [
{
"context" : "serviceType",
"element" : "data",
"variable" : "data"
}
],
"target" : [
{
"context" : "coding",
"contextType" : "variable",
"element" : "system",
"transform" : "translate",
"parameter" : [
{
"valueId" : "data"
},
{
"valueString" : "#serviceMap"
},
{
"valueString" : "code"
}
]
}
]
}
]
}
]
}
]
},
{
"name" : "R31LeistungsdatumServiceDate",
"source" : [
{
"context" : "service",
"element" : "ServiceDate",
"variable" : "serviceData"
}
],
"target" : [
{
"context" : "chargeItem",
"contextType" : "variable",
"element" : "occurrence",
"variable" : "occurrence",
"transform" : "create",
"parameter" : [
{
"valueString" : "dateTime"
}
]
},
{
"context" : "occurrence",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%serviceData.data"
}
]
}
]
},
{
"name" : "R315PersonV40PersonV40",
"source" : [
{
"context" : "service",
"element" : "PersonV40",
"variable" : "personV40"
}
],
"target" : [
{
"context" : "chargeItem",
"contextType" : "variable",
"element" : "performer",
"variable" : "performer",
"transform" : "create",
"parameter" : [
{
"valueString" : "BackboneElement"
}
]
}
],
"dependent" : [
{
"name" : "PersonV40ToPerformer",
"variable" : [
"personV40",
"performer"
]
}
]
},
{
"name" : "R39ErbringendeOrganizationProviderID",
"source" : [
{
"context" : "service",
"element" : "ProviderID",
"variable" : "providerID"
}
],
"target" : [
{
"context" : "chargeItem",
"contextType" : "variable",
"element" : "performingOrganization",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "display",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%providerID.data"
}
]
}
]
},
{
"name" : "R34AuftraggebendeKostenstelleReferrerID",
"source" : [
{
"context" : "service",
"element" : "ReferrerID",
"variable" : "referrerID"
}
],
"target" : [
{
"context" : "chargeItem",
"contextType" : "variable",
"element" : "costCenter",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "display",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%referrerID.data"
}
]
}
]
},
{
"name" : "R313AnzahlQuantity",
"source" : [
{
"context" : "service",
"element" : "Quantity",
"variable" : "quantity"
}
],
"target" : [
{
"context" : "chargeItem",
"contextType" : "variable",
"element" : "quantity",
"variable" : "q",
"transform" : "create",
"parameter" : [
{
"valueString" : "Quantity"
}
]
},
{
"context" : "q",
"contextType" : "variable",
"element" : "value",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%quantity.data"
}
]
}
]
},
{
"name" : "R310ErfasserEnteredBy",
"source" : [
{
"context" : "service",
"element" : "EnteredBy",
"variable" : "enteredBy"
}
],
"target" : [
{
"context" : "chargeItem",
"contextType" : "variable",
"element" : "enterer",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "display",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%enteredBy.data"
}
]
}
]
},
{
"name" : "R38ErfassungsdatumEnteredDateTime",
"source" : [
{
"context" : "service",
"element" : "EnteredDateTime",
"variable" : "enteredDateTime"
}
],
"target" : [
{
"context" : "chargeItem",
"contextType" : "variable",
"element" : "enteredDate",
"variable" : "enteredDate",
"transform" : "create",
"parameter" : [
{
"valueString" : "dateTime"
}
]
},
{
"context" : "enteredDate",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%enteredDateTime.data"
}
]
}
]
},
{
"name" : "patientContactID",
"source" : [
{
"context" : "service",
"element" : "PatientContactID",
"variable" : "patientContactID"
}
],
"rule" : [
{
"name" : "PatientContactID",
"source" : [
{
"context" : "patientContactID",
"element" : "data",
"variable" : "data"
}
],
"target" : [
{
"context" : "chargeItem",
"contextType" : "variable",
"element" : "identifier",
"variable" : "identifier",
"transform" : "create",
"parameter" : [
{
"valueString" : "Identifier"
}
]
},
{
"context" : "identifier",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueId" : "data"
}
]
}
]
}
]
},
{
"name" : "costweight",
"source" : [
{
"context" : "service",
"element" : "Costweight",
"variable" : "costweight"
}
],
"rule" : [
{
"name" : "Costweight",
"source" : [
{
"context" : "costweight",
"element" : "data",
"variable" : "data"
}
],
"target" : [
{
"context" : "chargeItem",
"contextType" : "variable",
"element" : "factorOverride",
"transform" : "copy",
"parameter" : [
{
"valueId" : "data"
}
]
}
]
}
]
},
{
"name" : "ServiceProcedureToFhirProcedure",
"source" : [
{
"context" : "service",
"element" : "Procedure",
"variable" : "proc"
}
&n